package move.method;

/**
 * Created by Administrator on 2018/1/25.
 */
public class AccountType {

    boolean isPremium() {
        return false;
    }

    //搬移过来的函数,只搬移一个字段
    double overdraftChargeRF(int daysOverdrawn) {
        if (isPremium()) {
            double result = 10;
            if (daysOverdrawn > 7) {
                result += (daysOverdrawn - 7) * 0.85;
                return result;
            } else {
                return daysOverdrawn * 1.75;
            }
        }
        return 0;
    }

    //第二种搬移方法,搬移整个对象
    double overdraftChargeRF(Account account) {
        if (isPremium()) {
            double result = 10;
            if (account.getDaysOverdrawn() > 7) {
                result += (account.getDaysOverdrawn() - 7) * 0.85;
                return result;
            } else {
                return account.getDaysOverdrawn() * 1.75;
            }
        }
        return 0;
    }

}
